/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = (exports = {});

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1640662726504_7419';

  // add your middleware config here
  config.middleware = [];

  // config.session = {
  //   key: 'SESSION_ID',
  //   maxAge: 24 * 3600 * 1000, // 1 day
  //   httpOnly: true,
  //   encrypt: true,
  //   renew: true, // 每次访问页面都会给session会话延长时间
  // };

  // https://blog.csdn.net/weixin_43704471/article/details/90763103
  config.security = {
    csrf: {
      enable: false,
    },
  };

  config.mysql = {
    // database configuration
    client: {
      // host
      host: 'localhost',
      // port
      port: '3306',
      // username
      user: 'root',
      // password
      password: 'lwh@chuwang1.com',
      // password: '',
      // database
      database: 'engry',
    },
    // load into app, default is open
    app: true,
    // load into agent, default is close
    agent: false,
  };

  config.jwt = {
    secret: 'engrySecret',
    expiresIn: 60 * 60, // 24小时
  };

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
    // httpProxy: {
    //   '/api': {
    //     target: 'target',
    //   },
    // },
  };
};
